package com.senac.dao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

public class BDUtil {

	public static void finalizeConnection(Connection con) {
		finalizeConnection(null, null, con);
	}
	
	public static void finalizeConnection(PreparedStatement ps, Connection con) {
		finalizeConnection(null, ps, con);
	}
	
	public static void finalizeConnection(ResultSet rs, PreparedStatement ps, Connection con) {
		try {
			if(rs != null) {
				rs.close();
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		try {
			if(ps != null) {
				ps.close();
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		try {
			if(con != null) {
				con.close();
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
}
